<template>
		<!-- 与包裹页面所有内容的元素u-page同级，且在它的下方 -->
		<u-tabbar  active-color="#5098ff" v-if="list.length > 0" v-bind="$attrs" @change="change" v-model="current" :list="list" :mid-button="midButton"></u-tabbar>
</template>

<script>
	import pathList from './path.js'
	export default {
		name:'uni-utabbar',
		props:{
			path:{
				type:String,
				default:''
			},
			midButton:{ // 是否出现中心的图表
				type:Boolean,
				default:false
			}
		},
		data() {
			return {
				list: pathList[this.path] || [],
				current: 0
			}
		},
		watch:{
			path:function() {
				this.list = pathList[this.path] || []
			}
		},
		methods:{
			change(e) {
				this.$emit('change',{
					index:e,
					item:this.list[e] || {}
				})
			}
		}
	}
</script>